(*

CS520 Project
William Blair

The interface for accessing random numbers.

*)

#define ATS_STALOADFLAG 0 // no need fro staloading at run-time

staload "generator.sats"
staload "container.sats"

(* Prepare the random environment. *)
fun random_setup() : void

(* A probability distribution *)
abst@ype distribution

fun cmp_dist (id:label,dist:distribution) : bool

fun distribution_parse{l:addr}{n:int}(data: !input(l,n)) : distribution

//fun distribution_save (id: label, dist: distribution) : void
(* All distribution's come with a label.*)
fun distribution_save(dist:distribution) : void

fun distribution_remove (id: label) : void

fun distribution_next_number(id: label) : double

fun distribution_next_random_number (dist:distribution) : double

(* Distribution Specific Parsing Functions *)

fun distribution_parse_normal{l:addr}{n:int} (data: !input(l,n)) : distribution

fun distribution_parse_exponential{l:addr}{n:int} (data: !input(l,n)) : distribution

fun distribution_parse_uniform{l:addr}{n:int} (data: !input(l,n)) : distribution

fun distribution_parse_constant{l:addr}{n:int} (data: !input(l,n)) :distribution

(* Distribution Specific Retrieval Functions *)

fun distribution_next_normal (dist: distribution) : double

fun distribution_next_exponential (dist: distribution) : double

fun distribution_next_uniform (dist: distribution) : double

fun distribution_next_constant (dist: distribution) : double